/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-05-27
*/
package com.rzico.order.entity;

import com.rzico.annotation.IgnoreSwaggerParameter;
import com.rzico.basics.entity.Shop;
import com.rzico.core.entity.SysEmployee;
import com.rzico.core.entity.SysOffice;
import com.rzico.order.enumx.AllocateShippingStatusEnum;
import com.rzico.order.enumx.AllocateStatusEnum;
import com.rzico.order.enumx.WxCheckOrderStatusEnum;
import lombok.Data;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * <pre>
 *   盘点单数据库对象
 * </pre>
 * @author Rzico Boot
 * @version 1.0
 */
@Data
@JsonIgnoreProperties(value = {"handler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
@Table(name = "wx_check")
public class WxCheck{
    @Id
    @ApiModelProperty(value = "" )
    protected Long id;

    @ApiModelProperty(value = "盘点单号" )
    protected String sn;

    @ApiModelProperty(value = "创建日期" )
    protected java.util.Date createDate;

    @ApiModelProperty(value = "修改日期" )
    protected java.util.Date modifyDate;

    @ApiModelProperty(value = "盘点日期" )
    protected java.util.Date orderDate;

    @ApiModelProperty(value = "备注" )
    protected String memo;

    @ApiModelProperty(value = "所属部门" )
    protected String officeId;

    @ApiModelProperty(value = "调拨企业" )
    protected Long enterpriseId;

    @ApiModelProperty(value = "调入门店" )
    protected Long shopId;

    @ApiModelProperty(value = "单据状态(0、未确认 1、已确认、2、已取消)" )
    protected Integer orderStatus;

    @JsonIgnore
    @ApiModelProperty(value = "创建者" ,hidden = true )
    protected String createBy;

    @JsonIgnore
    @ApiModelProperty(value = "更新者" ,hidden = true )
    protected String modifyBy;

    @ApiModelProperty(value = "操作人")
    protected String operatorId;

    @ApiModelProperty(value = "盘点明细")
    protected List<WxCheckItem> itemList = Collections.emptyList();

    @JsonIgnore
    @IgnoreSwaggerParameter
    public Shop shop;

    @JsonIgnore
    @IgnoreSwaggerParameter
    public SysOffice sysOffice;

    @ApiModelProperty(value = "入库门店名称", hidden = true)
    public String getShopName(){
        Shop shop = getShop();
        if (null != shop){
            return shop.getName();
        }else{
            return "";
        }
    }

    public void setShopName(String shopName){

    }


    @ApiModelProperty(value = "部门名称", hidden = true)
    public String getOfficeName(){
        SysOffice sysOffice = getSysOffice();
        if (null != sysOffice){
            return sysOffice.getName();
        }else{
            return "";
        }
    }

    public void setOfficeName(String officeName){

    }


    @JsonIgnore
    @IgnoreSwaggerParameter
    public SysEmployee sysEmployee;

    @ApiModelProperty(value = "人员名称", hidden = true)
    public String getOperatorName(){
        SysEmployee sysEmployee = getSysEmployee();
        if (null != sysEmployee){
            return sysEmployee.getName();
        }else{
            return "";
        }
    }

    public void setOperatorName(String operatorName){

    }

    @ApiModelProperty(value = "状态")
    public String getStatusDescr() {
        if (getOrderStatus().equals(WxCheckOrderStatusEnum.ORDER_STATUS_CANCELED.getId()) ) {
            return "已关闭";
        } else
        if (getOrderStatus().equals(WxCheckOrderStatusEnum.ORDER_STATUS_CONFIRM.getId())) {
            return "已完成";
        } else
        if (getOrderStatus().equals(WxCheckOrderStatusEnum.ORDER_STATUS_UNCONFIRM.getId())) {
            return "未确认";
        } else {
            return "未知状态";
        }
    }

    public void setStatusDescr(String value) {

    }
}
